OstreeObjectType objtype,
OstreeRepoMode repo_mode);
-void
-_ostree_loose_path_with_suffix (char *buf,
- const char *checksum,
- OstreeObjectType objtype,
- OstreeRepoMode repo_mode,
- const char *suffix);
-
#define _OSTREE_METADATA_GPGSIGS_NAME "ostree.gpgsigs"
#define _OSTREE_METADATA_GPGSIGS_TYPE G_VARIANT_TYPE ("aay")
return "commit";
case OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT:
return "tombstone-commit";
+ case OSTREE_OBJECT_TYPE_COMMIT_META:
+ return "commitmeta";
default:
g_assert_not_reached ();
return NULL;
return OSTREE_OBJECT_TYPE_DIR_META;
else if (!strcmp (str, "commit"))
return OSTREE_OBJECT_TYPE_COMMIT;
+ else if (!strcmp (str, "tombstone-commit"))
+ return OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT;
+ else if (!strcmp (str, "commitmeta"))
+ return OSTREE_OBJECT_TYPE_COMMIT_META;
g_assert_not_reached ();
return 0;
}
OstreeObjectType objtype,
OstreeRepoMode mode)
{
- _ostree_loose_path_with_suffix (buf, checksum, objtype, mode, "");
+ *buf = checksum[0];
+ buf++;
+ *buf = checksum[1];
+ buf++;
+ snprintf (buf, _OSTREE_LOOSE_PATH_MAX - 2, "/%s.%s%s",
+ checksum + 2, ostree_object_type_to_string (objtype),
+ (!OSTREE_OBJECT_TYPE_IS_META (objtype) && mode == OSTREE_REPO_MODE_ARCHIVE_Z2) ? "z" : "");
}
/**
return ret;
}
-/*
- * _ostree_loose_path_with_suffix:
- * @buf: Output buffer, must be _OSTREE_LOOSE_PATH_MAX in size
- * @checksum: ASCII checksum
- * @objtype: Object type
- * @mode: Repository mode
- *
- * Like _ostree_loose_path, but also append a further arbitrary
- * suffix; useful for finding non-core objects.
- */
-void
-_ostree_loose_path_with_suffix (char *buf,
- const char *checksum,
- OstreeObjectType objtype,
- OstreeRepoMode mode,
- const char *suffix)
-{
- *buf = checksum[0];
- buf++;
- *buf = checksum[1];
- buf++;
- snprintf (buf, _OSTREE_LOOSE_PATH_MAX - 2, "/%s.%s%s%s",
- checksum + 2, ostree_object_type_to_string (objtype),
- (!OSTREE_OBJECT_TYPE_IS_META (objtype) && mode == OSTREE_REPO_MODE_ARCHIVE_Z2) ? "z" : "",
- suffix);
-}
-
/*
* _ostree_get_relative_object_path:
* @checksum: ASCII checksum string
* @OSTREE_OBJECT_TYPE_DIR_META: Directory metadata
* @OSTREE_OBJECT_TYPE_COMMIT: Toplevel object, refers to tree and dirmeta for root
* @OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT: Toplevel object, refers to a deleted commit
+ * @OSTREE_OBJECT_TYPE_COMMIT_META: Detached metadata for a commit
*
* Enumeration for core object types; %OSTREE_OBJECT_TYPE_FILE is for
* content, the other types are metadata.
OSTREE_OBJECT_TYPE_DIR_META = 3, /* .dirmeta */
OSTREE_OBJECT_TYPE_COMMIT = 4, /* .commit */
OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT = 5, /* .commit-tombstone */
+ OSTREE_OBJECT_TYPE_COMMIT_META = 6, /* .commitmeta */
} OstreeObjectType;
/**
*
* Returns: %TRUE if object type is metadata
*/
-#define OSTREE_OBJECT_TYPE_IS_META(t) (t >= 2 && t <= 5)
+#define OSTREE_OBJECT_TYPE_IS_META(t) (t >= 2 && t <= 6)
/**
* OSTREE_OBJECT_TYPE_LAST:
*
* Last valid object type; use this to validate ranges.
*/
-#define OSTREE_OBJECT_TYPE_LAST OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT
+#define OSTREE_OBJECT_TYPE_LAST OSTREE_OBJECT_TYPE_COMMIT_META
/**
* OSTREE_DIRMETA_GVARIANT_FORMAT:
const char *checksum)
{
char buf[_OSTREE_LOOSE_PATH_MAX];
- _ostree_loose_path_with_suffix (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT, self->mode,
- "meta");
+ _ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);
return g_file_resolve_relative_path (self->objects_dir, buf);
}
if (is_detached_meta)
{
char buf[_OSTREE_LOOSE_PATH_MAX];
- _ostree_loose_path_with_suffix (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT,
- pull_data->remote_mode, "meta");
+ _ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, pull_data->remote_mode);
obj_uri = suburi_new (pull_data->base_uri, "objects", buf, NULL);
}
else
{
char meta_loose[_OSTREE_LOOSE_PATH_MAX];
- _ostree_loose_path_with_suffix (meta_loose, sha256,
- OSTREE_OBJECT_TYPE_COMMIT, self->mode, "meta");
+ _ostree_loose_path (meta_loose, sha256, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);
do
res = unlinkat (self->objects_dir_fd, meta_loose, 0);